<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->increments('id');
            $table->string('serial')->unqiue();     //商品序号
            $table->string('symbol')->unqiue();     //
            $table->string('postion');                //
            $table->string('style');                //
            $table->string('name')->nulable();     //商品名称
            $table->string('category');     //商品种类、分类
            $table->string('brand')->nulable();        //商品品牌
            $table->string('color');        //商品颜色
            $table->string('size');     //商品尺码
            $table->integer('number');      //商品数量
            $table->decimal('price')->nulable();       //商品进货价格
            $table->boolean('state')->default(true);        //商品状态
            $table->string('picurl')->default('default.png');       //商品图样
            $table->text('remark')->nulable();     //备注
            $table->timestamp('purchasetimes')->default(DB::raw('CURRENT_TIMESTAMP'));    //进货时间
            $table->string('users_id');     //商品录入人员
            $table->integer('referers_id')->nulable();  //商品来源表
            $table->string('stores_id')->nulable();    //库存表序号标识存储的位置
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('goods');
    }
}
